SharpRethinking


open System
open System.IO
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__

NuGet packages

#r "nuget: Plotly.NET, 3.0.0"
#r "nuget: Plotly.NET.Interactive, 3.0.2"
#r "nuget: MathNet.Numerics, 5.0.0"

open Plotly.NET
open Plotly.NET.Interactive
open MathNet.Numerics
open MathNet.Numerics.Distributions

Scripts

#load "Common.fsx"

open Common
open Common.GridApproximation

Practice

Problems are labeled Easy(E), Medium(M), and Hard(H).

2E1. Which of the expressions below correspond to the statement: the probability of rain on Monday ?

(4) \(Pr(rain|Monday)\)

2E2. Which of the following statements corresponds to the expression: \(Pr(rain|Monday)\) ?

(3) The probability of rain, given that it is Monday.

2E3. Pr(Monday|rain); Pr(rain|Monday)Pr(Monday) / Pr(rain)

2E4. "the probability of water is 0.7" -> Here, 0.7 represents the proportion of the globe that is covered in water.

Medium

2M1. Recall the globe tossing model from the chapter. Compute and plot the grid approximate posterior distribution for each of the following sets of observations.

In each case, assume a uniform prior for p.

For the globe tossing model, the random variable \(X\) represents the number of times you observe water when tossing the globe. The true proportion of water covering the globe is \(p\), and so the probability of observing water (W) on each single independent toss is also \(p\). Conversely, the probability or true proportion of land (L) covering the globe is \(q = (1 - p)\).

The probability of getting exactly \(k\) successes in \(n\) independent Bernoulli trials is given by the probability mass function (PMF):

\[f(k,n,p)=Pr(k;n,p)=Pr(X=k)={n \choose x}p^{k}q^{n-k} \text{ , for } k = 0, 1, 2, \ldots, n\]

\[n \in \mathbb{N} \text{ , } p \in [0,1]\]

Here, \({n \choose x} = \frac{n!}{k!(n-k)!}\), represents the number of ways "\(k\) successes" can happen out of "\(n\) trials."

For example, in the globe tossing model, if we consider \(n=3\) and \(k=1\):

Possible outcomes:

\(\{ LLL, \boldsymbol{LLW}, \boldsymbol{LWL} , \boldsymbol{WLL}, LWW , WWL, WWW \}\)

Equivalently,

\({n \choose x} = \frac{3!}{( 1! (3 - 1)! )} = 3\)

For each possible path, we have to account for the respective probabities \(p\) and \(q\). Since each Bernoulli trial is independent we can simply multiply the probabilities \(p\) and \(q\) to obtain the probability of a successful path (\(X=k\)). In our example, \(p \cdot p \cdot q\) or simply \(p^{2} \cdot q\). And so \(P(X=1)\) is the sum of the probabilities of all paths with exactly \(1\) successes, which is \({3 \choose 1}p^{1}q^{2}\).

let binomialBreakdownFig priorFunc nTrials nSucesses = 
    let title = sprintf  @"""$ \text{ Binomial distribution - } (n=%i,\: k=%i) $""" nTrials nSucesses
    let paramGrid = Generate.LinearSpaced(10000, 0., 1.)
    let prior = paramGrid |> Array.map priorFunc
    let likelihood = paramGrid |> Array.map (fun xs -> Binomial.PMF(p=xs, n=nTrials, k=nSucesses))

    [
        Chart.Line(paramGrid, prior, LineDash=StyleParam.DrawingStyle.Dot, Name="Prior")
        |> Chart.withYAxisStyle("Probability")
        
        Chart.Line(paramGrid, likelihood, LineDash=StyleParam.DrawingStyle.Dot, Name="Likelihood")
        |> Chart.withYAxisStyle("Probability")

        Chart.Line(paramGrid, posteriorProbabilities prior likelihood, Name="Posterior")
        |> Chart.withYAxisStyle("Probability")

    ]
    |> Chart.SingleStack(Pattern= StyleParam.LayoutGridPattern.Coupled)
    |> Chart.withLayoutGridStyle(YGap= 0.1)
    |> Chart.withXAxisStyle("""$ \text{ Parameter } p$""")
    |> Chart.withTitle(title)
    |> Chart.withSize(1000, 600)
    |> Chart.withMathTex(true)

2M1. Uniform Prior | N=3, W=3, L=0

binomialBreakdownFig (fun x -> 1.) 3 3 |> Chart.show

2M1. Uniform Prior | N=4, W=3, L=1

binomialBreakdownFig (fun x -> 1.) 4 3 |> Chart.show

2M1. Uniform Prior | N=7, W=5, L=2

binomialBreakdownFig (fun x -> 1.) 7 5 |> Chart.show

2M2. Now assume a prior for \(p\) that is equal to zero when \(p < 0.5\) and is a positive constant when p > 0.5 . Again compute and plot the grid approximate posterior distribution for each of the sets of observations in the problem just above.

2M2. Heavyside step function Prior | N=3, W=3, L=0

binomialBreakdownFig (fun x -> if x < 0.5 then 0. else 1.) 3 3

2M2. Heavyside step function Posterior | N=4, W=3, L=1

binomialBreakdownFig (fun x -> if x < 0.5 then 0. else 1.) 4 3

2M2. (W,W,W) - Heavyside step function Prior | N=7, W=5, L=2

binomialBreakdownFig (fun x -> if x < 0.5 then 0. else 1.) 7 5

Computing the posterior distribution by grid approximation comes with its caveats. As shown below, the approximation will get closer to the analytically solved version of the posterior distribution.

let multiBinominalPosteriorFig priorFunc points nTrials nSuccesses = 
    let title = sprintf @"""$ \text{Grid approximation - Posterior Distribution } (n=%i, k=%i)$" nTrials nSuccesses
    points
    |> Seq.map (fun xs -> 
        let probas = Generate.LinearSpaced(xs, 0., 1.)
        let prior = probas|> Array.map priorFunc
        Chart.Line(probas, binomialPosterior prior nTrials nSuccesses, Name = $"# Grid Points: {probas.Length}"))
    |> Chart.combine
    |> Chart.withTitle(title)
    |> Chart.withXAxisStyle(@"$ \text{Parameter } p$")
    |> Chart.withYAxisStyle("Posterior probability")
    |> Chart.withSize(1000, 500)
multiBinominalPosteriorFig (fun x -> 1.) [10 .. 10 .. 100] 10 1

2M3. Suppose there are two globes, one for Earth and one for Mars. The Earth globe is 70% covered in water. The Mars globe is 100% land. Further suppose that one of these globes—you don’t know which—was tossed in the air and produced a “land” observation. Assume that each globe was equally likely to be tossed. Show that the posterior probability that the globe was the Earth, conditional on seeing “land” (Pr(Earth|land)), is 0.23.

Pr(Earth|Land) = 0.23 Pr(Earth|Land) = Pr(Land|Earth) * Pr(Earth) / Pr(Land)

let prLandGivenEarth = 0.3
let prLandGivenMars = 1.
let prEarth = 0.5
let prMars = 0.5

let prLand = (prMars * prLandGivenMars) + (prEarth * prLandGivenEarth)
let prEarthGivenLand = (prLandGivenEarth * prEarth) / (prLand)

2M4.

3 Cards - X, Y, Z 2 Sides - B, W

BB, BW, WW

Additional sources -

  1. https://en.wikipedia.org/wiki/Binomial_distribution
  2. https://www3.nd.edu/~dgalvin1/10120/10120_S16/Topic19_8p6_Galvin.pdf
namespace System
namespace System.IO
type Environment = static member Exit: exitCode: int -> unit static member ExpandEnvironmentVariables: name: string -> string static member FailFast: message: string -> unit + 1 overload static member GetCommandLineArgs: unit -> string[] static member GetEnvironmentVariable: variable: string -> string + 1 overload static member GetEnvironmentVariables: unit -> IDictionary + 1 overload static member GetFolderPath: folder: SpecialFolder -> string + 1 overload static member GetLogicalDrives: unit -> string[] static member SetEnvironmentVariable: variable: string * value: string -> unit + 1 overload static member CommandLine: string ...
<summary>Provides information about, and means to manipulate, the current environment and platform. This class cannot be inherited.</summary>
property Environment.CurrentDirectory: string with get, set
<summary>Gets or sets the fully qualified path of the current working directory.</summary>
<exception cref="T:System.ArgumentException">Attempted to set to an empty string ("").</exception>
<exception cref="T:System.ArgumentNullException">Attempted to set to <see langword="null" />.</exception>
<exception cref="T:System.IO.IOException">An I/O error occurred.</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">Attempted to set a local path that cannot be found.</exception>
<exception cref="T:System.Security.SecurityException">The caller does not have the appropriate permission.</exception>
<returns>The directory path.</returns>
namespace Plotly
namespace Plotly.NET
namespace Plotly.NET.Interactive
namespace MathNet
namespace MathNet.Numerics
namespace MathNet.Numerics.Distributions
namespace Common
module GridApproximation from Common
val binomialBreakdownFig: priorFunc: (float -> float) -> nTrials: int -> nSucesses: int -> GenericChart.GenericChart
val priorFunc: (float -> float)
val nTrials: int
val nSucesses: int
val title: string
val sprintf: format: Printf.StringFormat<'T> -> 'T
<summary>Print to a string using the given format.</summary>
<param name="format">The formatter.</param>
<returns>The formatted result.</returns>
<example>See <c>Printf.sprintf</c> (link: <see cref="M:Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThen``1" />) for examples.</example>
val paramGrid: float[]
type Generate = static member Fibonacci: length: int -> BigInteger[] static member FibonacciSequence: unit -> IEnumerable<BigInteger> static member Impulse: length: int * amplitude: float * delay: int -> float[] static member ImpulseSequence: amplitude: float * delay: int -> IEnumerable<float> static member LinearRange: start: int * stop: int -> float[] + 2 overloads static member LinearRangeInt32: start: int * stop: int -> int[] + 1 overload static member LinearRangeMap<'T> : start: float * step: float * stop: float * map: Func<float,'T> -> 'T[] static member LinearSpaced: length: int * start: float * stop: float -> float[] static member LinearSpacedMap<'T> : length: int * start: float * stop: float * map: Func<float,'T> -> 'T[] static member LogSpaced: length: int * startExponent: float * stopExponent: float -> float[] ...
Generate.LinearSpaced(length: int, start: float, stop: float) : float[]
val prior: float[]
type Array = interface ICollection interface IEnumerable interface IList interface IStructuralComparable interface IStructuralEquatable interface ICloneable member Clone: unit -> obj member CopyTo: array: Array * index: int -> unit + 1 overload member GetEnumerator: unit -> IEnumerator member GetLength: dimension: int -> int ...
<summary>Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.</summary>
val map: mapping: ('T -> 'U) -> array: 'T[] -> 'U[]
<summary>Builds a new array whose elements are the results of applying the given function to each of the elements of the array.</summary>
<param name="mapping">The function to transform elements of the array.</param>
<param name="array">The input array.</param>
<returns>The array of transformed elements.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
<example id="map-1"><code lang="fsharp"> let inputs = [| "a"; "bbb"; "cc" |] inputs |&gt; Array.map (fun x -&gt; x.Length) </code> Evaluates to <c>[| 1; 3; 2 |]</c></example>
val likelihood: float[]
val xs: float
Multiple items
type Binomial = interface IDiscreteDistribution interface IUnivariateDistribution interface IDistribution new: p: float * n: int -> unit + 1 overload member CumulativeDistribution: x: float -> float member Probability: k: int -> float member ProbabilityLn: k: int -> float member Sample: unit -> int + 2 overloads member Samples: values: int[] -> unit + 5 overloads member ToString: unit -> string ...
<summary> Discrete Univariate Binomial distribution. For details about this distribution, see <a href="http://en.wikipedia.org/wiki/Binomial_distribution">Wikipedia - Binomial distribution</a>. </summary>
<remarks> The distribution is parameterized by a probability (between 0.0 and 1.0). </remarks>


--------------------
Binomial(p: float, n: int) : Binomial
Binomial(p: float, n: int, randomSource: Random) : Binomial
Binomial.PMF(p: float, n: int, k: int) : float
argument p: float
<summary> Computes the probability mass (PMF) at k, i.e. P(X = k). </summary>
<param name="k">The location in the domain where we want to evaluate the probability mass function.</param>
<param name="p">The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.</param>
<param name="n">The number of trials (n). Range: n ≥ 0.</param>
<returns>the probability mass at location <paramref name="k" />.</returns>
argument n: int
<summary> Computes the probability mass (PMF) at k, i.e. P(X = k). </summary>
<param name="k">The location in the domain where we want to evaluate the probability mass function.</param>
<param name="p">The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.</param>
<param name="n">The number of trials (n). Range: n ≥ 0.</param>
<returns>the probability mass at location <paramref name="k" />.</returns>
argument k: int
<summary> Computes the probability mass (PMF) at k, i.e. P(X = k). </summary>
<param name="k">The location in the domain where we want to evaluate the probability mass function.</param>
<param name="p">The success probability (p) in each trial. Range: 0 ≤ p ≤ 1.</param>
<param name="n">The number of trials (n). Range: n ≥ 0.</param>
<returns>the probability mass at location <paramref name="k" />.</returns>
type Chart = static member AnnotatedHeatmap: zData: seq<#seq<'a1>> * annotationText: seq<#seq<string>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?X: seq<#IConvertible> * ?XGap: int * ?Y: seq<#IConvertible> * ?YGap: int * ?Text: 'a5 * ?MultiText: seq<'a5> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?ZSmooth: SmoothAlg * ?Transpose: bool * ?UseWebGL: bool * ?ReverseYAxis: bool * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a5 :> IConvertible) + 1 overload static member Area: x: seq<#IConvertible> * y: seq<#IConvertible> * ?ShowMarkers: bool * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: MarkerSymbol * ?MultiMarkerSymbol: seq<MarkerSymbol> * ?Marker: Marker * ?LineColor: Color * ?LineColorScale: Colorscale * ?LineWidth: float * ?LineDash: DrawingStyle * ?Line: Line * ?StackGroup: string * ?Orientation: Orientation * ?GroupNorm: GroupNorm * ?FillColor: Color * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload static member Bar: values: seq<#IConvertible> * ?Keys: seq<#IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: PatternShape * ?MultiMarkerPatternShape: seq<PatternShape> * ?MarkerPattern: Pattern * ?Marker: Marker * ?Base: #IConvertible * ?Width: 'a4 * ?MultiWidth: seq<'a4> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload static member BoxPlot: ?X: seq<#IConvertible> * ?Y: seq<#IConvertible> * ?Name: string * ?ShowLegend: bool * ?Text: 'a2 * ?MultiText: seq<'a2> * ?FillColor: Color * ?MarkerColor: Color * ?Marker: Marker * ?Opacity: float * ?WhiskerWidth: float * ?BoxPoints: BoxPoints * ?BoxMean: BoxMean * ?Jitter: float * ?PointPos: float * ?Orientation: Orientation * ?OutlineColor: Color * ?OutlineWidth: float * ?Outline: Line * ?AlignmentGroup: string * ?OffsetGroup: string * ?Notched: bool * ?NotchWidth: float * ?QuartileMethod: QuartileMethod * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 2 overloads static member Bubble: x: seq<#IConvertible> * y: seq<#IConvertible> * sizes: seq<int> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: MarkerSymbol * ?MultiMarkerSymbol: seq<MarkerSymbol> * ?Marker: Marker * ?LineColor: Color * ?LineColorScale: Colorscale * ?LineWidth: float * ?LineDash: DrawingStyle * ?Line: Line * ?StackGroup: string * ?Orientation: Orientation * ?GroupNorm: GroupNorm * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload static member Candlestick: ``open`` : seq<#IConvertible> * high: seq<#IConvertible> * low: seq<#IConvertible> * close: seq<#IConvertible> * x: seq<#IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?Text: 'a5 * ?MultiText: seq<'a5> * ?Line: Line * ?IncreasingColor: Color * ?Increasing: FinanceMarker * ?DecreasingColor: Color * ?Decreasing: FinanceMarker * ?WhiskerWidth: float * ?UseDefaults: bool -> GenericChart (requires 'a5 :> IConvertible) + 1 overload static member Column: values: seq<#IConvertible> * ?Keys: seq<#IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: PatternShape * ?MultiMarkerPatternShape: seq<PatternShape> * ?MarkerPattern: Pattern * ?Marker: Marker * ?Base: #IConvertible * ?Width: 'a4 * ?MultiWidth: seq<'a4> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload static member Contour: zData: seq<#seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?X: seq<#IConvertible> * ?Y: seq<#IConvertible> * ?Text: 'a4 * ?MultiText: seq<'a4> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?Transpose: bool * ?ContourLineColor: Color * ?ContourLineDash: DrawingStyle * ?ContourLineSmoothing: float * ?ContourLine: Line * ?ContoursColoring: ContourColoring * ?ContoursOperation: ConstraintOperation * ?ContoursType: ContourType * ?ShowContourLabels: bool * ?ContourLabelFont: Font * ?Contours: Contours * ?FillColor: Color * ?NContours: int * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a4 :> IConvertible) static member Funnel: x: seq<#IConvertible> * y: seq<#IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?Width: float * ?Offset: float * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?Orientation: Orientation * ?AlignmentGroup: string * ?OffsetGroup: string * ?MarkerColor: Color * ?MarkerOutline: Line * ?Marker: Marker * ?TextInfo: TextInfo * ?ConnectorLineColor: Color * ?ConnectorLineStyle: DrawingStyle * ?ConnectorFillColor: Color * ?ConnectorLine: Line * ?Connector: FunnelConnector * ?InsideTextFont: Font * ?OutsideTextFont: Font * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) static member Heatmap: zData: seq<#seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?X: seq<#IConvertible> * ?XGap: int * ?Y: seq<#IConvertible> * ?YGap: int * ?Text: 'a4 * ?MultiText: seq<'a4> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?ZSmooth: SmoothAlg * ?Transpose: bool * ?UseWebGL: bool * ?ReverseYAxis: bool * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a4 :> IConvertible) + 1 overload ...
static member Chart.Line: xy: seq<#IConvertible * #IConvertible> * ?ShowMarkers: bool * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: StyleParam.TextPosition * ?MultiTextPosition: seq<StyleParam.TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: StyleParam.Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: StyleParam.MarkerSymbol * ?MultiMarkerSymbol: seq<StyleParam.MarkerSymbol> * ?Marker: TraceObjects.Marker * ?LineColor: Color * ?LineColorScale: StyleParam.Colorscale * ?LineWidth: float * ?LineDash: StyleParam.DrawingStyle * ?Line: Line * ?StackGroup: string * ?Orientation: StyleParam.Orientation * ?GroupNorm: StyleParam.GroupNorm * ?Fill: StyleParam.Fill * ?FillColor: Color * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart.GenericChart (requires 'a2 :> IConvertible)
static member Chart.Line: x: seq<#IConvertible> * y: seq<#IConvertible> * ?ShowMarkers: bool * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'c * ?MultiText: seq<'c> * ?TextPosition: StyleParam.TextPosition * ?MultiTextPosition: seq<StyleParam.TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: StyleParam.Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: StyleParam.MarkerSymbol * ?MultiMarkerSymbol: seq<StyleParam.MarkerSymbol> * ?Marker: TraceObjects.Marker * ?LineColor: Color * ?LineColorScale: StyleParam.Colorscale * ?LineWidth: float * ?LineDash: StyleParam.DrawingStyle * ?Line: Line * ?StackGroup: string * ?Orientation: StyleParam.Orientation * ?GroupNorm: StyleParam.GroupNorm * ?Fill: StyleParam.Fill * ?FillColor: Color * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart.GenericChart (requires 'c :> IConvertible)
module StyleParam from Plotly.NET
type DrawingStyle = | Solid | Dash | Dot | DashDot | User of int member Convert: unit -> obj override ToString: unit -> string static member convert: (DrawingStyle -> obj) static member toString: (DrawingStyle -> string)
<summary> Dash: Sets the drawing style of the lines segments in this trace. Sets the style of the lines. Set to a dash string type or a dash length in px. </summary>
union case StyleParam.DrawingStyle.Dot: StyleParam.DrawingStyle
static member Chart.withYAxisStyle: ?TitleText: string * ?TitleFont: Font * ?TitleStandoff: int * ?Title: Title * ?Color: Color * ?AxisType: StyleParam.AxisType * ?MinMax: (#IConvertible * #IConvertible) * ?Mirror: StyleParam.Mirror * ?ShowSpikes: bool * ?SpikeColor: Color * ?SpikeThickness: int * ?ShowLine: bool * ?LineColor: Color * ?ShowGrid: bool * ?GridColor: Color * ?ZeroLine: bool * ?ZeroLineColor: Color * ?Anchor: StyleParam.LinearAxisId * ?Side: StyleParam.Side * ?Overlaying: StyleParam.LinearAxisId * ?Domain: (float * float) * ?Position: float * ?CategoryOrder: StyleParam.CategoryOrder * ?CategoryArray: seq<#IConvertible> * ?RangeSlider: LayoutObjects.RangeSlider * ?RangeSelector: LayoutObjects.RangeSelector * ?BackgroundColor: Color * ?ShowBackground: bool * ?Id: StyleParam.SubPlotId -> (GenericChart.GenericChart -> GenericChart.GenericChart)
val posteriorProbabilities: prior: float[] -> likelihood: float[] -> float array
static member Chart.SingleStack: ?SubPlots: (StyleParam.LinearAxisId * StyleParam.LinearAxisId)[][] * ?XAxes: StyleParam.LinearAxisId[] * ?YAxes: StyleParam.LinearAxisId[] * ?RowOrder: StyleParam.LayoutGridRowOrder * ?Pattern: StyleParam.LayoutGridPattern * ?XGap: float * ?YGap: float * ?Domain: LayoutObjects.Domain * ?XSide: StyleParam.LayoutGridXSide * ?YSide: StyleParam.LayoutGridYSide -> (#seq<GenericChart.GenericChart> -> GenericChart.GenericChart)
type LayoutGridPattern = | Independent | Coupled member Convert: unit -> obj override ToString: unit -> string static member convert: (LayoutGridPattern -> obj) static member toString: (LayoutGridPattern -> string)
<summary> Pattern to use for autogenerating Axis Ids when not specifically specifying subplot axes IDs in LayoutGrids </summary>
union case StyleParam.LayoutGridPattern.Coupled: StyleParam.LayoutGridPattern
<summary> Gives one x axis per column and one y axis per row </summary>
static member Chart.withLayoutGridStyle: ?SubPlots: (StyleParam.LinearAxisId * StyleParam.LinearAxisId)[][] * ?XAxes: StyleParam.LinearAxisId[] * ?YAxes: StyleParam.LinearAxisId[] * ?Rows: int * ?Columns: int * ?RowOrder: StyleParam.LayoutGridRowOrder * ?Pattern: StyleParam.LayoutGridPattern * ?XGap: float * ?YGap: float * ?Domain: LayoutObjects.Domain * ?XSide: StyleParam.LayoutGridXSide * ?YSide: StyleParam.LayoutGridYSide -> (GenericChart.GenericChart -> GenericChart.GenericChart)
static member Chart.withXAxisStyle: ?TitleText: string * ?TitleFont: Font * ?TitleStandoff: int * ?Title: Title * ?Color: Color * ?AxisType: StyleParam.AxisType * ?MinMax: (#IConvertible * #IConvertible) * ?Mirror: StyleParam.Mirror * ?ShowSpikes: bool * ?SpikeColor: Color * ?SpikeThickness: int * ?ShowLine: bool * ?LineColor: Color * ?ShowGrid: bool * ?GridColor: Color * ?ZeroLine: bool * ?ZeroLineColor: Color * ?Anchor: StyleParam.LinearAxisId * ?Side: StyleParam.Side * ?Overlaying: StyleParam.LinearAxisId * ?Domain: (float * float) * ?Position: float * ?CategoryOrder: StyleParam.CategoryOrder * ?CategoryArray: seq<#IConvertible> * ?RangeSlider: LayoutObjects.RangeSlider * ?RangeSelector: LayoutObjects.RangeSelector * ?BackgroundColor: Color * ?ShowBackground: bool * ?Id: StyleParam.SubPlotId -> (GenericChart.GenericChart -> GenericChart.GenericChart)
static member Chart.withTitle: title: Title -> (GenericChart.GenericChart -> GenericChart.GenericChart)
static member Chart.withTitle: title: string * ?TitleFont: Font -> (GenericChart.GenericChart -> GenericChart.GenericChart)
static member Chart.withSize: width: float * height: float -> (GenericChart.GenericChart -> GenericChart.GenericChart)
static member Chart.withSize: ?Width: int * ?Height: int -> (GenericChart.GenericChart -> GenericChart.GenericChart)
static member Chart.withMathTex: ?AppendTags: bool -> (GenericChart.GenericChart -> GenericChart.GenericChart)
val x: float
static member Chart.show: ch: GenericChart.GenericChart -> unit
module GenericChart from Plotly.NET
<summary> Module to represent a GenericChart </summary>
val toChartHTML: gChart: GenericChart.GenericChart -> string
<summary> Converts a GenericChart to it HTML representation. The div layer has a default size of 600 if not specified otherwise. </summary>
val multiBinominalPosteriorFig: priorFunc: (float -> float) -> points: seq<int> -> nTrials: int -> nSuccesses: int -> GenericChart.GenericChart
val points: seq<int>
val nSuccesses: int
module Seq from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.seq`1" />.</summary>
val map: mapping: ('T -> 'U) -> source: seq<'T> -> seq<'U>
<summary>Builds a new collection whose elements are the results of applying the given function to each of the elements of the collection. The given function will be applied as elements are demanded using the <c>MoveNext</c> method on enumerators retrieved from the object.</summary>
<remarks>The returned sequence may be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
<param name="mapping">A function to transform items from the input sequence.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
<example id="item-1"><code lang="fsharp"> let inputs = ["a"; "bbb"; "cc"] inputs |&gt; Seq.map (fun x -&gt; x.Length) </code> Evaluates to a sequence yielding the same results as <c>seq { 1; 3; 2 }</c></example>
val xs: int
val probas: float[]
val binomialPosterior: prior: float[] -> nTrials: int -> nSuccesses: int -> float array
property Array.Length: int with get
<summary>Gets the total number of elements in all the dimensions of the <see cref="T:System.Array" />.</summary>
<exception cref="T:System.OverflowException">The array is multidimensional and contains more than <see cref="F:System.Int32.MaxValue" /> elements.</exception>
<returns>The total number of elements in all the dimensions of the <see cref="T:System.Array" />; zero if there are no elements in the array.</returns>
static member Chart.combine: gCharts: seq<GenericChart.GenericChart> -> GenericChart.GenericChart
val prLandGivenEarth: float
val prLandGivenMars: float
val prEarth: float
val prMars: float
val prLand: float
val prEarthGivenLand: float